#include "wuSimpleMovieManager.h"

wuSimpleMovieManager::wuSimpleMovieManager()
{
}

wuSimpleMovieManager::~wuSimpleMovieManager()
{
}

void wuSimpleMovieManager::setup(string _filename)
{
	movie.setup(_filename);
}


void wuSimpleMovieManager::update()
{
	movie.update();
}

void wuSimpleMovieManager::draw(bool bDrawLines, int offX)
{
    if(status==STAT_PREVISUALIZE || status==STAT_GO)
        movie.draw(bDrawLines,offX);
}

void wuSimpleMovieManager::drawSelected(bool bDrawLines, int offX)
{
    if(selection.width == vw && selection.height == vh)
    {
        if(status==STAT_PREVISUALIZE || status==STAT_GO)
            movie.draw(bDrawLines,offX);
    }
}

void wuSimpleMovieManager::setPosition(ofPoint _pos)
{
	movie.setPosition(_pos);
}
bool wuSimpleMovieManager::drag(int _x,int _y)
{
    bool bDrag=false;

    if(status==STAT_PREVISUALIZE)
    {
        movie.drag(_x,_y);
        bDrag=true;
    }

    return bDrag;
}
void wuSimpleMovieManager::dragOff()
{
    if(status==STAT_PREVISUALIZE)
        movie.dragOff();
}
bool wuSimpleMovieManager::action(int action)
{
    bool bCambiazo = false;

    if(action==ACT_CLEAR)
    {
        movie.clear();
        status = STAT_NONE;
    }
    if(action==ACT_PREVISUALIZE)
    {
        status = STAT_PREVISUALIZE;
        movie.previsualize();
    }
    if(action==ACT_PLAY)
    {
        movie.play();
        if(status!=STAT_GO)
            bCambiazo = true;
        status = STAT_GO;
    }

    return bCambiazo;
}
void wuSimpleMovieManager::clear()
{
    if(selection.width == vw && selection.height == vh)
    {
        status = STAT_NONE;
        movie.clear();
    }
}
